package cn.tedu.mapper;

import cn.tedu.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    @Select("select * from user where username=#{username} and password=#{password}")
    User selectUserByUP(User user);
    @Select("select count(1) from user")
    long findTotal();

    List<User> findUserByPage(@Param("start") int start,
                              @Param("size") int size,
                              @Param("query") String query);
    @Update("update user set status = #{status} where id = #{id}")
    void updateStatusById(User user);

    void addUser(User user);
    @Select("select * from user where id = #{id}")
    User findUserById(Integer id);
    @Update("update user set phone = #{phone},email = #{email} where id = #{id}")
    void updateUserById(User user);
    @Delete("delete from user where id = #{id}")
    void deleteUserById(Integer id);
}
